<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <!-- <link rel="stylesheet" href=""> -->
    <style>
        * {
            padding: 0;
            margin: 0;
        }
    </style>
</head>

<body>
    <div>
        <button class="get">获取</button>
        <button class="set">设置</button>
    </div>
    <a href="https://www.baidu.com" target="_self">
        <img src="../images/bg.jpg" width="400" alt="">
    </a>
    <!-- <a href=""></a>
    <link rel="stylesheet" href=""> -->

    <!-- <img src="" alt=""> -->
    <!-- <script src=""></script> -->
    <!-- <video src=""></video> -->
    <!-- <audio src=""></audio> -->
</body>
<script>

    // 元素节点的内置属性(某些元素独有的)
    // href   获取和设置元素href属性 (a link)
    // target 获取和设置元素target属性 (a)
    // src    获取和设置元素src属性 (img)
    // width  获取和设置元素width属性(img width)

    var getBtn = document.getElementsByClassName("get")[0];
    var setBtn = document.getElementsByClassName("set")[0];

    var a = document.querySelector("a");
    var img = document.querySelector("img");

    getBtn.onclick = function () {
        console.log(a.href);
        console.log(a.target);

        console.log(img.src);
        console.log(img.width);
        console.log(img.height);
    }

    setBtn.onclick = function () {
        a.href = "./02 小广告.html";
        a.target = "_blank";

        img.src = "../images/bg_4.jpg";
        img.width = 200;
    }


</script>

</html>